package com.example.mobile2021606176mhq0427;

import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainSsk;
    private Button btnMainSs;
    private RecyclerView rvMainPark;
    private List<park> list = new ArrayList();
    private int[]parkIds={R.drawable.p1,R.drawable.p2,R.drawable.p3,R.drawable.p4,R.drawable.p5};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        rvMainPark.setLayoutManager(new LinearLayoutManager(this));
        rvMainPark.setAdapter(new parkRVAdapter(list));
            list.add(new park(R.drawable.p1,"广州停车场","空位：50","价格：35/小时","距离：15公里","地址：广州市天河区","更多信息"));
            list.add(new park(R.drawable.p2,"深圳停车场","空位：60","价格：40/小时","距离：10公里","地址：深圳市罗湖区","更多信息"));
            list.add(new park(R.drawable.p3,"佛山停车场","空位：65","价格：30/小时","距离：20公里","地址：佛山市南海区","更多信息"));
            list.add(new park(R.drawable.p4,"江门停车场","空位：40","价格：28/小时","距离：22公里","地址：江门市蓬江区","更多信息"));
            list.add(new park(R.drawable.p5,"惠州停车场","空位：40","价格：27/小时","距离：24公里","地址：惠州市惠城区","更多信息"));
    }

    private void initView() {
        tvMainSsk = (TextView) findViewById(R.id.tv_main_ssk);
        btnMainSs = (Button) findViewById(R.id.btn_main_ss);
        rvMainPark = (RecyclerView) findViewById(R.id.rv_main_park);
    }


}